import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore(
  'user',
  () => {
    const userInfo = ref({})
    const token = ref('')

    const setUserInfo = (value) => {
      userInfo.value = value
    }

    const setToken = (value) => {
      token.value = value
    }

    return {
      userInfo,
      token,
      setUserInfo,
      setToken
    }
  },
  {
    persist: true
  }
)
